﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace Swproject
{
    public partial class printResultsfrm : Form
    {
        public printResultsfrm()
        {
             InitializeComponent();
        }
         String constring = "datasource=localhost; port=3307; username=root; password=root;";
            String Query = "SELECT Balance FROM atm.account WHERE(Account_number='" + this.txtnum.Text + "');";
            MySqlConnection conDataBase = new MySqlConnection(constring);
            MySqlCommand cmdDataBase = new MySqlCommand(Query, conDataBase);
            MySqlDataReader myReader;


            try
            {
                conDataBase.Open();
                myReader = cmdDataBase.ExecuteReader();
                
                foreach (int qu in Query) {
                    MessageBox.Show(qu.ToString());
                
                }
               //while (myReader.Read())
               // {
               //     MessageBox.Show(Query);


               // }


            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
    }
}
